﻿#region [===== Using =====]
using System;
using System.Collections;
using Microsoft.SharePoint;
#endregion

namespace TPG.SharePoint.Workflow
{
    /// <summary>
    /// Provides a special type of <see cref="TaskData" /> that is able
    /// to identify the task list item using the list item ID.
    /// </summary>
    /// <remarks>
    /// This class is used by the <see cref="BulkTaskControl" /> to 
    /// differentiate between the different task list items when editing
    /// tasks in bulk.
    /// </remarks>
    public class TaskItem 
        : TaskData
    {
        #region [===== Fields =====]
        private int _listItemid;
        private string _itemDisplayName;
        #endregion

        #region [===== Properties =====]
        /// <summary>
        /// The ID of the list item representing the task data.
        /// </summary>
        public int ListItemId
        {
            get { return _listItemid; }
        }
        
        /// <summary>
        /// The display name of the list item representing the task data.
        /// </summary>
        public string ItemDisplayName
        {
            get { return _itemDisplayName; }
        }
        #endregion

        #region [===== Constructors =====]
        internal TaskItem(int id, SPContentType contentType)
            : this(id, null, contentType)
        {
        }

        internal TaskItem(int id, string itemDisplayName, SPContentType contentType)
            : base(contentType)
        {
            _listItemid = id;
            _itemDisplayName = itemDisplayName;
        }

        internal TaskItem(int id, string itemDisplayName,
            SPListItem listItem, Hashtable extendedProperties)
            : base(listItem, extendedProperties)
        {
            _listItemid = id;
            _itemDisplayName = itemDisplayName;
        }
        #endregion
    }
}
